﻿{template 'header', $module}
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tab" id="add"><a href="sms.php?action=add"><span>Send SMS</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="action_buy"><a href="sms.php?action=buy"><span>SMS purchase</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="action"><a href="sms.php"><span>SMS record</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="action_record"><a href="sms.php?action=record"><span>Receive Record</span></a></td>
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="action_send"><a href="sms.php?action=send"><span>Send records</span></a></td>
<td class="tab_nav">&nbsp;</td>
</tr>
</table>
</div>
{if $action == 'add'}
<form method="post" action="sms.php" onsubmit="return check();" id="dform">
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl"><span class="f_red">*</span> Reception number</td>
<td class="tr">
<textarea name="mob" id="mob" rows="2" cols="35">{$mob}</textarea><br/>
[Line of a phone number]&nbsp;&nbsp;
<a href="javascript:Dwidget('friend.php?action=my&from=sms', '[My Friends]', 600, 300);" class="t">[My Friends]</a><br/><span id="dmob" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Message content</td>
<td class="tr"><textarea name="content" id="content" rows="15" cols="35" onkeyup="S();" onblur="S();"></textarea>
<br/>Currently input<strong id="chars" class="f_red">0</strong>Word，Meter<strong id="counts" class="f_green">0</strong>Article({$DT[sms_len]}Word/Article)，Available<strong class="f_blue">{$_sms}</strong>Article
<br/><span id="dcontent" class="f_red"></span>
</td>
</tr>
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="50"><input type="submit" name="submit" value=" Determined " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/></td>
</tr>
</table>
</form>
<script type="text/javascript">
function S() {
	var sms_len = {$DT[sms_len]};
	Dd('chars').innerHTML = Dd('content').value.length;
	Dd('counts').innerHTML = Math.ceil(Dd('content').value.length/sms_len);
}
function check() {
	if(Dd('mob').value.length < 7) {
		Dmsg('Please fill out the receipt number', 'mob');
		return false;
	}
	if(Dd('content').value.length < 2) {
		Dmsg('Please fill out the content of the message', 'content');
		return false;
	}
}
</script>
<script type="text/javascript">s('sms');m('add');</script>
{elseif $action == 'buy'}
<form method="post" action="sms.php" onsubmit="return check();" id="dform">
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl">Account balance available</td>
<td class="tr"><strong class="f_blue">{$_money}</strong> {$DT[money_unit]}</td>
</tr>
<tr>
<td class="tl">SMS Price</td>
<td class="tr"><strong class="f_red">{$fee}</strong> {$DT[money_unit]}/Article</td>
</tr>
<tr>
<td class="tl">Remaining SMS</td>
<td class="tr"><strong>{$_sms}</strong> Article</td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Quantity</td>
<td class="tr c_p"><input type="text" name="total" id="total" size="10"/> Article&nbsp;<span id="dtotal" class="f_red"></span></td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> Payment password</td>
<td class="tr">{template 'password', 'chip'}&nbsp;<span id="dpassword" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="50"><input type="submit" name="submit" value=" Determined " class="btn"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value=" Reset " class="btn"/></td>
</tr>
</table>
</form>
<script type="text/javascript">
function check() {
	if(Dd('total').value == '') {
		Dmsg('Please enter the quantity', 'total');
		return false;
	}
	if(Dd('password').value == '') {
		Dmsg('Please fill out the payment password', 'password');
		return false;
	}
}
</script>
<script type="text/javascript">s('sms');m('action_buy');</script>
{elseif $action == 'record'}
<form action="?">
<div class="tt">
Keyword：<input type="text" size="30" name="kw" value="{$kw}" title="Keyword"/>&nbsp;
{dcalendar('fromtime', $fromtime)} To {dcalendar('totime', $totime)}&nbsp;
<input type="submit" value=" Search " class="btn"/>&nbsp;
<input type="button" value=" Reset" class="btn" onclick="Go('?action={$action}');"/>
</div>
</form>
<div class="bd">
<table cellpadding="1" cellspacing="0" class="tb">
<tr>
<th>Serial number</th>
<th width="110">Delivery time</th>
<th>Content</th>
<th>Words</th>
<th>Slitting</th>
<th>Status</th>
</tr>
{loop $lists $k $v}
<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
<td height="30" class="px11">{$v[itemid]}</td>
<td class="px11">{$v[sendtime]}</td>
<td align="left" style="width:150px;padding:8px;line-height:20px;">{$v[message]}</td>
<td class="px11">{$v[word]}</td>
<td class="px11">{$v[num]}</td>
<td>{$v[code]}</td>
</tr>
{/loop}
</table>
<div class="pages">{$pages}</div>
<script type="text/javascript">s('sms');m('action_record');</script>
{elseif $action == 'send'}
<form action="?">
<div class="tt">
Keyword：<input type="text" size="30" name="kw" value="{$kw}" title="Keyword"/>&nbsp;
{dcalendar('fromtime', $fromtime)} To {dcalendar('totime', $totime)}&nbsp;
<input type="submit" value=" Search " class="btn"/>&nbsp;
<input type="button" value=" Reset " class="btn" onclick="Go('?action={$action}');"/>
</div>
</form>
<div class="bd">
<table cellpadding="1" cellspacing="0" class="tb">
<tr>
<th>Serial number</th>
<th width="110">Delivery time</th>
<th>Content</th>
<th>Words</th>
<th>Slitting</th>
<th>Status</th>
</tr>
{loop $lists $k $v}
<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
<td height="30" class="px11">{$v[itemid]}</td>
<td class="px11">{$v[sendtime]}</td>
<td align="left" style="width:150px;padding:8px;line-height:20px;">{$v[message]}</td>
<td class="px11">{$v[word]}</td>
<td class="px11">{$v[num]}</td>
<td>{$v[code]}</td>
</tr>
{/loop}
</table>
<div class="pages">{$pages}</div>
<script type="text/javascript">s('sms');m('action_send');</script>
{else}
<form action="?">
<input type="hidden" name="action" value="{$action}"/>
<div class="tt">
{$fields_select}&nbsp;
<input type="text" size="30" name="kw" value="{$kw}" title="Keyword"/>&nbsp;
<select name="type">
<option value="0">Type</option>
<option value="1" {if $type==1}selected{/if}>Addition</option>
<option value="2" {if $type==2}selected{/if}>Deduction</option>
</select>
&nbsp;
{dcalendar('fromtime', $fromtime)} To {dcalendar('totime', $totime)}
&nbsp;
<input type="submit" value=" Search " class="btn"/>&nbsp;
<input type="button" value=" Reset " class="btn" onclick="Go('?action={$action}');"/>
</div>
</form>
<div class="bd">
<table cellpadding="1" cellspacing="0" class="tb">
<tr>
<th>Serial number</th>
<th>Addition</th>
<th>Deduction</th>
<th>Surplus</th>
<th width="150">Time of occurrence</th>
<th width="150">Subject</th>
<th width="150">Remark</th>
</tr>
{loop $lists $k $v}
<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
<td height="30" class="px11">{$v[itemid]}</td>
<td class="px11 f_blue">{if $v[amount] > 0}{$v[amount]}{else}&nbsp;{/if}</td>
<td class="px11 f_red">{if $v[amount] < 0}{$v[amount]}{else}&nbsp;{/if}</td>
<td class="px11">{if $v[balance]}{$v[balance]}{else}&nbsp;{/if}</td>
<td class="px11 f_gray">{$v[addtime]}</td>
<td title="{$v[reason]}"><input type="text" size="20" value="{$v[reason]}"/></td>
<td title="{$v[note]}"><input type="text" size="20" value="{$v[note]}"/></td>
</tr>
{/loop}
<tr align="center">
<td height="35"><strong>Subtotal</strong></td>
<td class="px11 f_blue">{$income}</td>
<td class="px11 f_red">{$expense}</td>
<td colspan="4">&nbsp;</td>
</tr>
</table>
<div class="pages">{$pages}</div>
<script type="text/javascript">s('sms');m('action');</script>
{/if}
{template 'footer', $module}